﻿@model IEnumerable<BK.Model.Account>

@{
    ViewBag.Title = "Рахунки";
	Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>@ViewBag.Title</h2>

@Html.ValidationSummary(true)

@(Html.Telerik().Grid(Model)
		.ToolBar(commands => commands
            .Custom()
                .HtmlAttributes(new { id = "create" })
                .Text("Створити")
						.Action("Create", ViewContext.RouteData.Values["controller"].ToString()))
		.Name("Grid")
		.PrefixUrlParameters(false)
		.Columns(columns =>
		{
			columns.Template(
				@<text>
					<span style="white-space: nowrap">
						@item.Name
					</span>
				</text>)
				.Title("Назва")
				.Width("1px");
			columns.Bound(o => o.Currency.Name).Title("Валюта");
		})
		.Pageable()
		.Sortable()
		.Filterable()
		.Columns(columns =>
		    {
                columns.Template(
                    @<text>
                         @Html.ActionLink("Редагувати", "Edit", new
                                {
                                    id = item.Id
                                },
                                new
                                    {
                                        @class = "t-button"
                                    })
                     </text>
                    ).Width("1px");
                columns.Template(
                    @<text>
                         @Html.ActionLink("Видалити", "Delete", new
                                {
                                    id = item.Id
                                },
                                new
                                    {
                                        @class = "t-button",
                                        onclick = "return deleteConfirmation()"
                                    })
                     </text>
                    ).Width("1px");
            })
)